// 建一个用户表（有姓名,年龄,年龄,创建时间,修改时间）,使用模块加mysql模块,实现对数据的增删改查
//###  修改时记得，把修改时间改成修改时的时间，能实现分页（选做）
let mysql = require("mysql");
const { rootCertificates } = require("tls");
let connection=mysql.createConnection({
    host:"localhost",
    user:"root",
    password:"root",    
    database:"123"
});
connection.connect();

//新增
let inter = "insert into 'user' values (null,'张三','男',18,'2004-1-1','2012-1-2')"
connection.query(inser,(err,date)=>{
    console.log("新增数据--------")
})

//查
connection.query("select * from user",(err,date)=>{
    console.log(data);
})

//删
let news=new Date().toLocaleString().replace('/','-').replace('/','-');
console.log(news);
let updates="update ueser set changtime '+news+' where name = '张三'";
connection.query(updates,(err,data)=>{
    console.log("修改数据--------");
})
console.log(new date().toLocaleString().replace('/','-').replace('/','-'));
connection.end();